SQL Support for SAP BW BEx

This section describes SQL support for SAP BW BEx resource types and their behavior within TDV SQL queries.

Introspection Resource Hierarchy
SQL Capabilities

Introspection Resource Hierarchy

This section describes the details of introspecting SAP BW BEx resources, including how the resource hierarchy appears in TDV and how metadata is mapped in TDV.

The organization of SAP BW BEx resources in TDV mirrors SAP BW BEx as much as possible.

InfoAreas in BEx Analyzer are displayed as folders in TDV, and these folders are named after the InfoAreas’ descriptions. If a description for an InfoArea is not available, its technical name is used in TDV. Move the mouse over an item to see a tooltip with its technical name and type.

SQL Capabilities

SQL capabilities characterize the features and limitations of data sources. For example, an Oracle data source can execute subqueries, while SAP BEx cannot. Capabilities are consulted when a query is processed so that data sources receive only the query processing work they support; otherwise, TDV performs the work itself.

The following table lists capabilities that apply to ODS Objects only—whether they are supported in queries against ODS Objects or can be pushed to SAP BEx for execution. For efficient queries, minimize use of non-push capabilities.

The capabilities for ODS objects are listed in the table.

Capability

Supported

Pushed

Notes

BETWEEN

Yes

Yes

See notes in WHERE.

CASE

Yes

No

 

CAST

Yes

Yes

 

DELETE

No

No

 

DISTINCT

Yes

No

 

Filters

Yes

Yes

See Filters.

Functions

Yes

No

CAST is pushed. Other functions are supported but not pushed.

GROUP BY

Yes

No

 

IN

Yes

Yes

See notes in WHERE.

INSERT

No

No

 

JOIN

Yes

No

See Joins and Semijoins.

LIKE

Yes

No

 

ORDER BY

Yes

Yes

Because of SAP BAPI limitations, order is always ascending (ASC). The ASC and DESC keywords are ignored.

Subquery

Yes

No

 

WHERE

Yes

Yes

See WHERE.

Filters

All conditional operators are supported. The keywords OR, AND, and grouping of terms with parentheses are supported, but have no impact on the query other than to indicate the list of filters. Filters containing NULL literals are ignored. Filters on key figures are not supported and are ignored.

Joins and Semijoins

Joins cannot be pushed to SAP BW. Meanwhile, executing joins in TDV can degrade performance, because a table scan would be required, and it would fetch every row of the joined tables. The technology that TDV uses to connect with SAP BW BEx is not optimized for large data sets, so it is best to avoid table scans.

A semijoin is the best way to reduce the number of SAP BW BEx rows retrieved and processed by TDV. To force a semijoin to occur in a query, add it immediately before the table to be joined. For example:

SELECT * 
FROM X INNER {OPTION SEMIJOIN} JOIN Y ON X.Key = Y.Key 

Values of X.Key are collected and passed in a query to Y as the filter:

SELECT * FROM X
SELECT * FROM Y WHERE Key IN ({values of X.Key from previous query})

Note: TDV semijoins involving BEx queries echo the input values (underscore columns) in the result set.

If X has many rows, queries against Y can be lengthy. If the queries against Y become too large, TDV automatically partitions them and reassembles the results into a unified set.

Whenever possible, put the table that returns the larger number of rows on the right side of the join. When running a new query for the first time, activate the Execution Plan tab in the Studio and click Execute and Show Statistics. Examine each node’s row count and query after processing has begun to make sure that filters are pushed down to SAP BW BEx. This is a good way to see the mechanics of a semijoin in action. If the interaction between TDV Server and SAP BW BEx is still unclear and performance is poor, enable debug logging as described in the TDV Installation and Upgrade Guide.

WHERE

SQL WHERE processing brings TDV closer to parity with BEx Analyzer and other tools in their ability to execute BEx queries. The BEx adapter supports these selection types:

Single Value—Characteristic, Hierarchy, and Hierarchy Node.
Several Single Values—Multiple parameter (or prompt) values of three variable types can appear in a single SQL statement via the IN clause. These variable types are: Characteristic, Hierarchy, and Hierarchy Node.
Intervals—The BEx adapter can set upper and lower bounds of an intervals using:
A BETWEEN clause
An equivalent pair of inequality operators

Exclusion Lists—Using the SQL NOT operator or equivalent inequality operator, you can modify the selection type of a variable value to exclude rather than (by default) include. This applies to all three supported selection types (above).